$(function() {
    var button = $('#loginButton');
    var box = $('#loginBox');
    var form = $('#loginForm');
    button.removeAttr('href');
    button.mouseup(function(login) {
        box.toggle();
        button.toggleClass('active');
    });
    form.mouseup(function() { 
        return false;
    });
    $(this).mouseup(function(login) {
        if(!($(login.target).parent('#loginButton').length > 0)) {
            button.removeClass('active');
            box.hide();
        }
    });
    
    //this part is for hiding and appearing button in item menu
    jQuery(".menu").hide(); //initially hide that
    
    jQuery(".item-hasil").hover(
        function(){
            jQuery(this).find(".menu").fadeIn(200);
        },
        function(){
            jQuery(this).find(".menu").fadeOut(200);
        }
    );
});

function compose() {
    document.getElementById('compose').removeAttribute('style');
}

function cancel() {
    document.getElementById('compose').setAttribute('style', 'display:none;');
}

function displaySearch(){
    if(document.getElementById('search-head').getAttribute('style') == null){
        this.hideSearch();
    }else{
        document.getElementById('search-head').removeAttribute('style');
        document.getElementById('search-icon').setAttribute('onclick', 'hideSearch()');
    }
}

function hideSearch(){
    document.getElementById('search-icon').setAttribute('onclick', 'displaySearch()');
    document.getElementById('search-head').setAttribute('style', 'display:none;');
}